﻿/*****************************************
 * 
 *  copyright (c) by ylshen
 * 
 *  author : ylshen (syl.lucky@gmail.com)
 *  
 *  created at : 08-05-21
 * 
 **************************************** */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;
using JYStockAnalyser.Model;

namespace JYStockAnalyser.WinUI
{
    public class IDGeter
    {
        public static ComputerUniqueNO GetUniqueNO()
        {
            ComputerUniqueNO uniqueNO = new ComputerUniqueNO();

            string cpuInfo = String.Empty;
            ManagementClass cimobject = new ManagementClass("Win32_Processor");
            ManagementObjectCollection moc = cimobject.GetInstances();
            foreach (ManagementObject mo in moc)
            {
                cpuInfo = mo.Properties["ProcessorId"].Value.ToString();

            }
            uniqueNO.CPU_NO = cpuInfo;

            //string hDInfo = string.Empty;
            //ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive");
            //ManagementObjectCollection moc1 = cimobject1.GetInstances();
            //foreach (ManagementObject mo in moc1)
            //{
            //    hDInfo = (string)mo.Properties["Model"].Value;
            //}
            //uniqueNO.DISK_NO = hDInfo;
            return uniqueNO;
        }
    }
}
